export interface IRouteChildConfig {
  path: string
  name?: string
  component: string
}
export interface IRouteConfig {
  path: string
  routes?: IRouteChildConfig[]
  component?: string
  redirect?: string
  exact?: boolean
  name?: string // 兼容此写法
  icon?: string
  // 更多功能查看
  // https://beta-pro.ant.design/docs/advanced-menu
  // ---
  // 新页面打开
  target?: string
  // 不展示顶栏
  headerRender?: boolean
  // 不展示页脚
  footerRender?: boolean
  // 不展示菜单
  menuRender?: boolean
  // 不展示菜单顶栏
  menuHeaderRender?: boolean
  // 权限配置，需要与 plugin-access 插件配合使用
  access?: string
  // 隐藏子菜单
  hideChildrenInMenu?: boolean
  // 隐藏自己和子菜单
  hideInMenu?: boolean
  // 在面包屑中隐藏
  hideInBreadcrumb?: boolean
  // 子项往上提，仍旧展示,
  flatMenu?: boolean
}

const routes: IRouteConfig[] = [
  {
    path: '/',
    exact: true,
    redirect: '/home'
  },
  {
    path: '/home',
    name: '首页',
    icon: 'HomeOutlined',
    component: '@/pages/home/index'
  },
  {
    path: '/login',
    // name: '登录',
    component: '@/pages/login/index',
    headerRender: false,
    // 不展示页脚
    footerRender: false,
    // 不展示菜单
    menuRender: false,
    // 不展示菜单顶栏
    menuHeaderRender: false
  },
  {
    path: '/pro',
    name: '产品管理',
    icon: 'HomeOutlined',
    routes: [
      {
        path: '/pro/list',
        name: '产品列表',
        component: '@/pages/pro/index'
      },
      {
        path: '/pro/seckill',
        name: '秒杀列表',
        component: '@/pages/pro/seckill'
      },
      {
        path: '/pro/recommend',
        name: '推荐列表',
        component: '@/pages/pro/recommend'
      },
      {
        path: '/pro/search',
        name: '筛选列表',
        component: '@/pages/pro/search'
      }
    ]
  },
  {
    path: '/banner',
    name: '轮播图管理',
    icon: 'HomeOutlined',
    routes: [
      {
        path: '/banner/list',
        name: '轮播图列表',
        component: '@/pages/banner/index'
      },
      {
        path: '/banner/add',
        // name: '轮播图列表',
        component: '@/pages/banner/add'
      }
    ]
  }
]

export default routes
